<?php

namespace app\common\model;

/**
 * [NewsCommentMessage  资讯评论信息表]
 * @author [C。]
 * @return html
 */
class NewsCommentMessage extends Base
{
    protected $name = "news_comment_message";
    /**
     * 获取列表
     */
    public function getlist($map,$from = 0, $size = 5,$field = '*')
    {
        $order = ['c.id' => 'desc'];

        $join2 = [
            ['app_member m','m.id = c.mid'],
        ];
        $result =  $this->field($field)
            ->alias('c')
            ->join($join2)
            ->where($map)
            ->limit($from, $size)
            ->order($order)
            ->select();

        return $result;
    }

    /**
     * 根据条件来获取列表的数据的总数
     * @param array $param
     */
    public function getCount($map = []) {
        $join2 = [
            ['app_member m','m.id = c.mid'],
        ];
        $result =  $this->alias('c')
            ->join($join2)
            ->where($map)
            ->count();

        return $result;
    }
}